///////////////////////////////////////page_otherCostdetails/////////////////////////
$(document).on("pageInit", "#page_otherCostdetails", function(e, pageId, $page) {
    my.givetitle('费用支付详情');
	key=my.get_key(my.getCookie('token'))
      	    	     //待付详情开始
      	    	    $.showPreloader()
                    var info_df={
                    	 waitfp_id:sessionStorage.waitfp_id,
                    	 type:sessionStorage.ewtype
                    }
                        info_df=my.cryptoASEencrypt(JSON.stringify(info_df),key)
      				$.ajax({
      					url:api.waitpayinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_df
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("待付详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.waitfp_id').text(data.waitfp_id)
      								    $('.channel_dec').text(data.channel_dec)
      								    $('.createdate').text(data.createdate)
      								    $('.payment_balance').text(config.danwei+data.payment_balance)
      								    $('.payment_cost').text(config.danwei+data.payment_cost)
      								    $('.payment_readycost').text(config.danwei+data.payment_readycost)
      								    $('.payment_volume').text(config.danwei+data.payment_volume)
      							 }
      								    
      								    
      						}
      					})
      				//维修费用开始
                $('.CROD-yc-head-ew-wxfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    		 $('.table-head-main-ew-wxfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wxfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                          console.log(info)
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderweixiuselect,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wxfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-ew-wxfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							     var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>车损项目</span><span>'+data.list[i].damage_item+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车损状况</span><span>'+data.list[i].damage_status+'</span></div>'
		 	                              +'<div class="table-head-a"><span>预估维修费</span><span>'+config.danwei+data.list[i].cost+'</span></div>'
		 	                               +'<div class="table-head-a"><span>时间</span><span>'+data.list[i].damage_time+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      
		 	                      $('.table-head-main-ew-wxfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    })
                 //维修费用结束
                 //违章费用开始
                $('.CROD-yc-head-ew-wzfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 $('.table-head-main-ew-wzfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wzfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                           }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiz,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq').hide()
      							$('.table-head-main-ew-wzfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违法行为代码</span><span>'+data.list[i].legal_code+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车辆牌照</span><span>'+data.list[i].car_plate+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法时间</span><span>'+data.list[i].legal_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法地点</span><span>'+data.list[i].legal_address+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法金额</span><span>'+config.danwei+data.list[i].legal_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].legal_remark+'</span></div>'
		 	                      $('.table-head-main-ew-wzfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				   
                }) //违章费用结束
                 //违约费用开始
                $('.CROD-yc-head-ew-wyfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		  $('.table-head-main-ew-wyfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wyfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiy,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq').hide()
      							$('.table-head-main-ew-wyfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违约类型</span><span>'+data.list[i].rental_type+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约时间</span><span>'+data.list[i].breach_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约金</span><span>'+config.danwei+data.list[i].breach_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约方</span><span>'+data.list[i].breach_owner+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].breach_remark+'</span></div>'
		 	                        $('.table-head-main-ew-wyfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				   
                }) //违约费用结束
                //额外费用开始
                $('.CROD-yc-head-ew-ewxm').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 $('.table-head-main-ew-ewxm').siblings('.fyxq-no').hide()
				    		  $('.table-head-main-ew-ewxm').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                          console.log(info)
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectewai,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq').hide()
      							$('.table-head-main-ew-ewxm').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>项目名</span><span>'+data.list[i].item_name+'</span></div>'
		 	                              +'<div class="table-head-a"><span>费用</span><span>'+config.danwei+data.list[i].item_cost+'</span></div>'
		 	                              +'<div class="table-head-a"><span>创建时间</span><span>'+data.list[i].item_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      $('.table-head-main-ew-ewxm').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    
                }) //额外费用结束
})